//- Copyright (C) 2018-2022 Chatopera Inc, <https://www.chatopera.com>
//- 
//- Licensed under the Apache License, Version 2.0 (the "License");
//- you may not use this file except in compliance with the License.
//- You may obtain a copy of the License at
//- 
//-  http://www.apache.org/licenses/LICENSE-2.0
//- 
//-  Unless required by applicable law or agreed to in writing, software
//- distributed under the License is distributed on an "AS IS" BASIS,
//-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//- See the License for the specific language governing permissions and
//- limitations under the License.
.row
    .col-lg-12
        h1.site-h1
            | 工作绩效（#{pugHelper.formatDate('yyyy-MM-dd', now)}）
        .box.ukefu-console(style="padding-top:0px !important;")
            img(src="/images/agent.png", alt="admin")
            .ukefu-user-index
                h1(style="width:120px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap: break-word;\
                word-break: break-all;")
                    | #{user.username}（#{user.uname}）
                    span(style="color:#c00;")
                        if user && user.roleList
                            for role in user.roleList
                                #{role.name}
                if user.lastlogintime
                    .ukefu-join-time.ukefu-text-muted 登录时间：#{pugHelper.formatDate('HH:mm:ss', user.lastlogintime)}
        .box.ukefu-console
            .ukefu-relation
                span.ukefu-relation-item(lay-event="")
                    | 会话
                    a.measure(href="/service/current/index.html")  #{agentUserCount}
                span.ukefu-relation-item(lay-event="")
                    | 邀请
                    a#agentInviteTotalTimes.measure(href="/apps/onlineuser.html")  #{inviteResult.users + inviteResult.inviteusers + inviteResult.refuseusers}
                span.ukefu-relation-item(lay-event="")
                    | 拒绝
                    a.measure( href="/apps/onlineuser.html", style=(inviteResult.refuseusers > 0 ? "color:red !important;" : "")) #{inviteResult.refuseusers}
                    .box.ukefu-console
                    .ukefu-relation
                span.ukefu-relation-item(lay-event="", style="width:20%;")
                    | 已接待
                    a.measure(href="/service/history/index.html")  #{agentServicesCount}
                span.ukefu-relation-item(style="width:55%;")
                    | 平均会话时长
                    a.measure(href="/service/history/index.html")
                        if agentServicesAvg
                            | #{pugHelper.padRight(agentServicesAvg / (1000 * 60 * 60), "00")}:#{pugHelper.padRight((agentServicesAvg % (1000 * 60 * 60)) / (1000 * 60), "00")}:#{pugHelper.padRight((agentServicesAvg % (1000 * 60)) / (1000), "00")}
                        else
                            | 00:00:00

.row
    .col-lg-12(style="padding:5px;border-top: 5px solid #e6e6e6;")
        .layui-tab.layui-tab-brief.ukefu-webim-tab(lay-filter="docDemoTabBrief")
            ul.layui-tab-title
                li.layui-this
                    i.layui-icon 
            .layui-tab-content
                .layui-tab-item.layui-show
                    ul.ukewo-btn-group
